#协同开发项目 2020/11/18 陈春鹏

class Shape:
    def __init__(self,name,area,perimeter):
        self.sName=name
        self.fArea=area
        self.fPerimeter=perimeter
    def calArea(self):
        pass
    def calPerimeter(self):
        pass
    def display(self):
        print("名称",self.sName)
        print("面积",self.fArea)
        print("周长",self.fPerimeter)
class Rectangle(Shape):
    def __init_(self,n,a,b):
        self.Name=n
        self.a=a
        self.b=b
    def calArea(self):
        area=round(self.a*self.b,2)
        return area
    def calPerimeter(self, ):
        perimeter=round(2*(self.a*self.b),2)
        return perimeter
class Trangle(Shape):
    def __init_(self,a,b,c):
        self.Name="三角形"
        self.a=a
        self.b=b
        self.c=c
    def calArea(self):
        p=0.5*(self.a+self.b+self.c)
        area=round(math.sqrt(p*(p-self.a)*p*(p-self.b)*p*(p-self.c)),2)
        return area
    def calPerimeter(self):
        perimeter=self.a+self.b+self.c
        return perimeter
class Circle(Shape):
    def __init_(self,a):
        self.Name="圆形"
        self.a=a
    def calArea(self):
        area=round(math.pi*self.a**2,2)
        return area
    def calPerimeter(self):
        perimeter=round(2*math.pi*self.a,2)
        return perimeter
rectangle=Rectangle("矩形",7,8)
print(Rectangle.calArea(),Rectangle.calPerimeter())